<template>
	<view class="container">
		<uni-list>
			<uni-list-chat v-for="item in list" :title="item.name" :avatarCircle="true"
				:avatar="'/static/head_icon.png'" :clickable="true" :showArrow="true" :showBadge="true"
				:badgeText="item.id" badgePositon="right" :note="item.department"
				:to='"../classmatedetail/classmatedetail?id="+item.id'></uni-list-chat>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": []
			}

		},
		methods: {
			loadyun() {
				let classmate = uniCloud.database().collection('freshmen')
				classmate.get().then(res => {
					uni.showToast({
						icon: 'success',
						title: '加载成功'
					})
					console.log(res.result);
					this.list = res.result.data
				})
			},
		},

		// loadclassmate() {
		// 	uni.request({
		// 		url: 'http://localhost:8090/freshmenapp/user/list',
		// 		method: 'POST',
		// 		data: {},
		// 		success: res => {
		// 			if (res.data.success === true) {
		// 				uni.hideLoading()
		// 				this.list = res.data.list
		// 				uni.showToast({
		// 					title: '成功',
		// 					icon: 'none'
		// 				});
		// 			} else {
		// 				this.list = []
		// 				uni.showToast({
		// 					title: '失败',
		// 					icon: 'none'
		// 				});
		// 			}
		// 		},
		// 		fail: () => {
		// 			uni.showToast({
		// 				title: '失败',
		// 				icon: 'none'
		// 			});
		// 		},
		// 		complete: () => {
		// 			uni.hideLoading()
		// 		}
		// 	});
		// }

		onLoad() {
			this.loadyun()
			console.log("onLoad");
			uni.showLoading({
				title: '加载中',
				mask: false
			});
		}
	}
</script>

<style>

</style>